package com.nowar.controller;

import com.nowar.common.result.response.ResponseCommonBase;
import com.nowar.common.service.MessageProvide;
import com.nowar.agent.TestProxy;
import com.nowar.entity.vo.ResponseUserInfoVo;
import com.nowar.entity.vo.UserInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 谢无殇。
 * @Date : 2023-01-14 21:53
 */
@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    private TestProxy testProxy;
    @Autowired
    private MessageProvide messageProvide;

    @GetMapping("/import")
    public ResponseUserInfoVo test01() {
        String message = messageProvide.getMessage("serviceName");
        UserInfoVo userInfoVo = new UserInfoVo();
        userInfoVo.setUserCode("zhangsan");
        ResponseUserInfoVo responseBase = testProxy.userInfo(userInfoVo, this::handlerResult);
        responseBase.getData().setUpdateBy(message);
        return responseBase;
    }

    private void handlerResult(Object response) {
        System.out.println(response);
    }
}
